﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;
using System.ComponentModel.DataAnnotations;
using System.Data.Entity;
namespace MezmurStore2.Models
{
    public class Album
    {
        private List<Track> _tracks;
        private string _poster;
        private string _title;
        public Guid Id { get; set; }

        [Required]
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                if (value != null)
                {
                    _title = value.Trim();
                }
            }
        }

        [Required]
        public string Gener { get; set; }

        public string Poster
        {
            get
            {
                if (string.IsNullOrEmpty(_poster))
                {
                    return @"/media/default.gif";
                }
                else
                {
                    return _poster;
                }
            }
            set
            {
                _poster = value;
            }
        }
        public List<Track> Tracks
        {
            get
            {
                if (_tracks == null)
                {
                    _tracks = new List<Track>();
                }
                return _tracks;
            }
            set
            {
                _tracks = value;
            }
        }
        public DateTime ReleaseDate { get; set; }
        public string OwnerUserId { get; set; }
    }
}